1. Field of the Invention
The present invention relates to systems which control machines or processes to share common resources and more particularly, to a system which controls machines or processes so one machine or process control program at a time is given exclusive use of at least one resource.
2. Description of the Prior Art
FIG. 1 shows the prior art interlock mechanism used in traditional robotic and other machine control applications. Two robots, A and B, for example, are interconnected not directly, but via a programmable logic controller (PLC). The actual interlock logic is inside the PLC, and the two robots use discrete I/O to communicate with the PLC.
When Robot A wishes to acquire the protected resource (in this example, the resource is a shared workspace), it sets Request A true. Robot B does the same. However, the PLC only permits one grant line to go true. One robot can proceed while the other waits for its grant to go true. In this way, there is presumably no collision between the two robots.
However, this mechanism has several drawbacks in actual practice:                1) PLC scan time causes timing problems.—When either side uses a resource, then its request line is cleared (OUT Request X=FALSE) at the end of the program section, the Grant line for that robot does not immediately go false. It will go false after the next PLC logic scan. If the same program loops back to retake the resource before the grant line goes false, the program will continue thinking the resource is available. After the scan delay, the PLC will grant control to the opposite side, and both sides will assume the resource simultaneously. If that resource is a shared workspace for example, the two robots will collide in that workspace. This problem is typically solved with delays built into the robot programs, making them inefficient.        2) Request and Wait are not atomic—The real problem in item 1 above is that with simple I/O communication with the PLC, the request operation and the wait for operation are not atomic (indivisible). In fact the wait for may return as a result of a previous request, not for the current request. The concept of a mutex (mutual exclusion) object is well known in computer science and well known in computer programming. Using such a mechanism, a program typically requests a resource, and the arbitrator for the mutex does not return from the request until the resource is available. By using a function call to both request the resource and return ownership of the resource, these operations are indivisible from the program's point of view. In this case the PLC does implement a proper mutex. However, the two robot controllers communicate with the PLC via simple I/O bits, and the atomic nature of the mutex operations is destroyed.        3) Only two programs can share a resource.—The interlock technique described here and commonly used in the industry only permits two programs to share the resource. If more than two programs need to share the resource, then more complicated PLC logic must be used for that special case.        4) Deadlock detection—When multiple programs share multiple resources, it is possible for two or more programs to end up in deadlock, with each program owning a resource while needing one owned by another. The PLC I/O interlock technique typically used in industry provides no way to detect this deadlock situation and considerable debugging time is often needed to find the problem.        5) Deadlock prevention—There are well known techniques from computer science for both detecting and helping to prevent deadlocks. However, the PLC I/O interlock technique has no way to implement these techniques. Computer operating systems provide various mutex mechanisms for multiple programs running on a single computer. In multi-processor systems, the operating system for the multi-processor system provides some mutex mechanism for sharing resources between programs on the system. However, there is no existing system that provides for a reliable interlock mechanism that solves all the above listed problems for control programs running on separate controllers connected only by a standard communications network and with potentially disparate operating systems on the separate controllers.        
U.S. Pat. No. 6,212,444 entitled “Method of avoiding interference of industrial robot” discloses a distance based method of avoiding the collision of a robot with another robot or cooperating apparatus. Each robot or device senses its own entrance into a commonly defined geometric region either by command or by interpolation along a path. When entering a region, each robot or apparatus sends a signal to prevent the other from entering, by causing it to stop and wait.
The method of U.S. Pat. No. 6,212,444 has disadvantages, some common to the prior art of FIG. 1 discussed above:                1) The signals sent between the robot and cooperating apparatus do not implement a mutually exclusive interlock. Though a collision is avoided, a potential deadlock is not. This type of deadlock is possible because there is no arbitrator to assign ownership of the shared resource. Thus, each apparatus can be stopped by the other, and each will wait forever for the other to proceed.        2) The method is based only on distance of the machines. The method cannot be used for arbitrary resource sharing.        3) There is no deadlock detection or prevention mechanism.        